﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.5
// Code is generated on: Monday, December 17, 2012 11:21:48 AM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.ComponentModel;
using System.Data;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
using WHMS;
using WHMS.FactoryClasses;
using WHMS.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;


namespace WHMS.TypedViewClasses
{
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END
	
	/// <summary>Typed datatable for the view 'Lookup'.<br/><br/></summary>
	[Serializable, System.ComponentModel.DesignerCategory("Code")]
	[ToolboxItem(true)]
	[DesignTimeVisible(true)]
	public partial class LookupTypedView : TypedViewBase<LookupRow>, ITypedView2
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfacesView
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private DataColumn _columnId;
		private DataColumn _columnName;
		private DataColumn _columnOrder;
		private DataColumn _columnType;
		private IEntityFields2	_fields;
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalMembers
		// __LLBLGENPRO_USER_CODE_REGION_END
		private static Hashtable	_customProperties;
		private static Hashtable	_fieldsCustomProperties;
		#endregion

		#region Class Constants
		/// <summary>
		/// The amount of fields in the resultset.
		/// </summary>
		private const int AmountOfFields = 4;
		#endregion

		/// <summary>Static CTor for setting up custom property hashtables.</summary>
		static LookupTypedView()
		{
			SetupCustomPropertyHashtables();
		}

		/// <summary>CTor</summary>
		public LookupTypedView():base("Lookup")
		{
			InitClass();
		}
#if !CF	
		/// <summary>Protected constructor for deserialization.</summary>
		/// <param name="info"></param>
		/// <param name="context"></param>
		protected LookupTypedView(SerializationInfo info, StreamingContext context):base(info, context)
		{
			if (SerializationHelper.Optimization == SerializationOptimization.None)
			{
				InitMembers();
			}
		}
#endif
		/// <summary>Gets the IEntityFields2 collection of fields of this typed view. </summary>
		/// <returns>Ready to use IEntityFields2 collection object.</returns>
		public virtual IEntityFields2 GetFieldsInfo()
		{
			return _fields;
		}

		/// <summary>Creates a new typed row during the build of the datatable during a Fill session by a dataadapter.</summary>
		/// <param name="rowBuilder">supplied row builder to pass to the typed row</param>
		/// <returns>the new typed datarow</returns>
		protected override DataRow NewRowFromBuilder(DataRowBuilder rowBuilder) 
		{
			return new LookupRow(rowBuilder);
		}

		/// <summary>Initializes the hashtables for the typed view type and typed view field custom properties. </summary>
		private static void SetupCustomPropertyHashtables()
		{
			_customProperties = new Hashtable();
			_fieldsCustomProperties = new Hashtable();
			Hashtable fieldHashtable;
			fieldHashtable = new Hashtable();
			_fieldsCustomProperties.Add("Id", fieldHashtable);
			fieldHashtable = new Hashtable();
			_fieldsCustomProperties.Add("Name", fieldHashtable);
			fieldHashtable = new Hashtable();
			_fieldsCustomProperties.Add("Order", fieldHashtable);
			fieldHashtable = new Hashtable();
			_fieldsCustomProperties.Add("Type", fieldHashtable);
		}

		/// <summary>
		/// Initialize the datastructures.
		/// </summary>
		protected override void InitClass()
		{
			TableName = "Lookup";		
			_columnId = GeneralUtils.CreateTypedDataTableColumn("Id", @"Id", typeof(System.Int32), this.Columns);
			_columnName = GeneralUtils.CreateTypedDataTableColumn("Name", @"Name", typeof(System.String), this.Columns);
			_columnOrder = GeneralUtils.CreateTypedDataTableColumn("Order", @"Order", typeof(System.Int16), this.Columns);
			_columnType = GeneralUtils.CreateTypedDataTableColumn("Type", @"Type", typeof(System.String), this.Columns);
			_fields = EntityFieldsFactory.CreateTypedViewEntityFieldsObject(TypedViewType.LookupTypedView);
			
			// __LLBLGENPRO_USER_CODE_REGION_START AdditionalFields
			// be sure to call _fields.Expand(number of new fields) first. 
			// __LLBLGENPRO_USER_CODE_REGION_END
			OnInitialized();
		}

		/// <summary>Initializes the members, after a clone action.</summary>
		private void InitMembers()
		{
			_columnId = this.Columns["Id"];
			_columnName = this.Columns["Name"];
			_columnOrder = this.Columns["Order"];
			_columnType = this.Columns["Type"];
			_fields = EntityFieldsFactory.CreateTypedViewEntityFieldsObject(TypedViewType.LookupTypedView);
			// __LLBLGENPRO_USER_CODE_REGION_START InitMembers
			// __LLBLGENPRO_USER_CODE_REGION_END
		}

		/// <summary>Clones this instance.</summary>
		/// <returns>A clone of this instance</returns>
		public override DataTable Clone() 
		{
			LookupTypedView cloneToReturn = ((LookupTypedView)(base.Clone()));
			cloneToReturn.InitMembers();
			return cloneToReturn;
		}
#if !CF			
		/// <summary>Creates a new instance of the DataTable class.</summary>
		/// <returns>a new instance of a datatable with this schema.</returns>
		protected override DataTable CreateInstance() 
		{
			return new LookupTypedView();
		}
#endif

		#region Class Property Declarations
		/// <summary>The custom properties for this TypedView type.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public static Hashtable CustomProperties
		{
			get { return _customProperties;}
		}

		/// <summary>The custom properties for the type of this TypedView instance.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[System.ComponentModel.Browsable(false)]
		public virtual Hashtable CustomPropertiesOfType
		{
			get { return LookupTypedView.CustomProperties;}
		}

		/// <summary>The custom properties for the fields of this TypedView type. The returned Hashtable contains per fieldname a hashtable of name-value pairs. </summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		public static Hashtable FieldsCustomProperties
		{
			get { return _fieldsCustomProperties;}
		}

		/// <summary>The custom properties for the fields of the type of this TypedView instance. The returned Hashtable contains per fieldname a hashtable of name-value pairs.</summary>
		/// <remarks>The data returned from this property should be considered read-only: it is not thread safe to alter this data at runtime.</remarks>
		[System.ComponentModel.Browsable(false)]
		public virtual Hashtable FieldsCustomPropertiesOfType
		{
			get { return LookupTypedView.FieldsCustomProperties;}
		}

		/// <summary>Returns the column object belonging to the TypedView field Id</summary>
		internal DataColumn IdColumn 
		{
			get { return _columnId; }
		}

		/// <summary>Returns the column object belonging to the TypedView field Name</summary>
		internal DataColumn NameColumn 
		{
			get { return _columnName; }
		}

		/// <summary>Returns the column object belonging to the TypedView field Order</summary>
		internal DataColumn OrderColumn 
		{
			get { return _columnOrder; }
		}

		/// <summary>Returns the column object belonging to the TypedView field Type</summary>
		internal DataColumn TypeColumn 
		{
			get { return _columnType; }
		}

		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalColumnProperties
		// __LLBLGENPRO_USER_CODE_REGION_END
 		#endregion

		#region Custom TypedView code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomTypedViewCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion

		#region Included Code

		#endregion
	}

	/// <summary>Typed datarow for the typed datatable Lookup</summary>
	public partial class LookupRow : DataRow
		// __LLBLGENPRO_USER_CODE_REGION_START AdditionalInterfacesRow
		// __LLBLGENPRO_USER_CODE_REGION_END	
	{
		#region Class Member Declarations
		private LookupTypedView	_parent;
		#endregion

		/// <summary>CTor</summary>
		/// <param name="rowBuilder">Row builder object to use when building this row</param>
		protected internal LookupRow(DataRowBuilder rowBuilder) : base(rowBuilder) 
		{
			_parent = ((LookupTypedView)(this.Table));
		}

		#region Class Property Declarations

		/// <summary>Gets / sets the value of the TypedView field Id<br/><br/></summary>
		/// <remarks>Mapped on view field: "Lookup"."Id"<br/>
		/// View field characteristics (type, precision, scale, length): Int, 10, 0, 0</remarks>
		public System.Int32 Id 
		{
			get { return IsIdNull() ? (System.Int32)TypeDefaultValue.GetDefaultValue(typeof(System.Int32)) : (System.Int32)this[_parent.IdColumn]; }
			set { this[_parent.IdColumn] = value; }
		}

		/// <summary>Returns true if the TypedView field Id is NULL, false otherwise.</summary>
		public bool IsIdNull() 
		{
			return IsNull(_parent.IdColumn);
		}

		/// <summary>Sets the TypedView field Id to NULL. Not recommended; a typed list should be used as a readonly object.</summary>
    	public void SetIdNull() 
		{
			this[_parent.IdColumn] = System.Convert.DBNull;
		}

		/// <summary>Gets / sets the value of the TypedView field Name<br/><br/></summary>
		/// <remarks>Mapped on view field: "Lookup"."Name"<br/>
		/// View field characteristics (type, precision, scale, length): NVarChar, 0, 0, 53</remarks>
		public System.String Name 
		{
			get { return IsNameNull() ? (System.String)TypeDefaultValue.GetDefaultValue(typeof(System.String)) : (System.String)this[_parent.NameColumn]; }
			set { this[_parent.NameColumn] = value; }
		}

		/// <summary>Returns true if the TypedView field Name is NULL, false otherwise.</summary>
		public bool IsNameNull() 
		{
			return IsNull(_parent.NameColumn);
		}

		/// <summary>Sets the TypedView field Name to NULL. Not recommended; a typed list should be used as a readonly object.</summary>
    	public void SetNameNull() 
		{
			this[_parent.NameColumn] = System.Convert.DBNull;
		}

		/// <summary>Gets / sets the value of the TypedView field Order<br/><br/></summary>
		/// <remarks>Mapped on view field: "Lookup"."Order"<br/>
		/// View field characteristics (type, precision, scale, length): SmallInt, 5, 0, 0</remarks>
		public System.Int16 Order 
		{
			get { return IsOrderNull() ? (System.Int16)TypeDefaultValue.GetDefaultValue(typeof(System.Int16)) : (System.Int16)this[_parent.OrderColumn]; }
			set { this[_parent.OrderColumn] = value; }
		}

		/// <summary>Returns true if the TypedView field Order is NULL, false otherwise.</summary>
		public bool IsOrderNull() 
		{
			return IsNull(_parent.OrderColumn);
		}

		/// <summary>Sets the TypedView field Order to NULL. Not recommended; a typed list should be used as a readonly object.</summary>
    	public void SetOrderNull() 
		{
			this[_parent.OrderColumn] = System.Convert.DBNull;
		}

		/// <summary>Gets / sets the value of the TypedView field Type<br/><br/></summary>
		/// <remarks>Mapped on view field: "Lookup"."type"<br/>
		/// View field characteristics (type, precision, scale, length): VarChar, 0, 0, 2</remarks>
		public System.String Type 
		{
			get { return IsTypeNull() ? (System.String)TypeDefaultValue.GetDefaultValue(typeof(System.String)) : (System.String)this[_parent.TypeColumn]; }
			set { this[_parent.TypeColumn] = value; }
		}

		/// <summary>Returns true if the TypedView field Type is NULL, false otherwise.</summary>
		public bool IsTypeNull() 
		{
			return IsNull(_parent.TypeColumn);
		}

		/// <summary>Sets the TypedView field Type to NULL. Not recommended; a typed list should be used as a readonly object.</summary>
    	public void SetTypeNull() 
		{
			this[_parent.TypeColumn] = System.Convert.DBNull;
		}
		#endregion
		
		#region Custom Typed View Row Code
		
		// __LLBLGENPRO_USER_CODE_REGION_START CustomTypedViewRowCode
		// __LLBLGENPRO_USER_CODE_REGION_END
		#endregion
		
		#region Included Row Code

		#endregion	
	}
}
